import api from '$g/api'
// import {alert} from '$js/utils'

/**
 * Created by 熊超超 on 2017/8/4.
 */
export default {
  state: {
    device: {}
  },
  mutations: {},
  actions: {
    async queryAllDevice ({state, commit, rootState}, params) {
      const config = {
        _loading: false
        // _hideGlobalError: true
      }
      params = {...config, ...params}
      const {data} = await api.queryAllDevice(params)
      return data
    },
    async queryOneDevice ({state, commit, rootState}, params) {
      const config = {
        _loading: false
        // _hideGlobalError: true
      }
      params = {...config, ...params}
      const {data} = await api.queryOneDevice(params)
      return data
    },
    async sendOrder ({state, commit, rootState}, params) {
      const {data} = await api.sendOrder(params)
      return data
    },
    async refresh ({state, commit, rootState}, params) {
      const {data} = await api.queryOneDevice(params)
      return data
    }
  },
  getters: {}
}
